package com.fengye.resign.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author sunlei
 * @version 1.0
 * @date 2024/5/28 13:53:25
 * @description WebMvcConfigurer
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    @Value("${files.upload.path}")
    private  String fileUploadPath;
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/uploads/**") // 访问路径前缀，如：http://localhost:8089/uploads/img/111.png 中的/uploads
                .addResourceLocations("file:" + fileUploadPath); // 文件实际存储位置
    }
}
